<template>
  <div>
    <el-form ref="ruleForm" :model="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-row>
        <el-col :span="24">
          <el-form-item label="数据分类" prop="dataType">
            <el-input v-model="ruleForm.dataType" clearable />
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
        <el-button @click="resetForm('ruleForm')">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  export default {
    props: {
      row: {
        type: Object,
        default: null
      }
    },
    data() {
      return {
        ruleForm: {

        }
      }
    },
    mounted() {
      this.ruleForm = {
        ...this.row
      }
    },
    methods: {
      resetForm() {
        this.$emit('close')
      },
      submitForm() {
        let params = {
          dataType: this.ruleForm.dataType || this.row.dataType,
          id: this.ruleForm.id
        }
        this.$server
          .dataClassifySubmit(params).then((res) => {
            this.$message({
              type: 'success',
              message: '修改成功'
            })
            this.$emit('dataClassify')
            this.$emit('close')
          })
      }
    }
  }
</script>

<style>
</style>
